﻿using System.Data.Entity.ModelConfiguration;
using yiCommerce.Core.Domain.Products;

namespace yiCommerce.Data.Mapping.Products
{
    public class ProductVariantAttributeValueMapping: EntityTypeConfiguration<ProductVariantAttributeValue>
    {
        public ProductVariantAttributeValueMapping()
        {
            this.ToTable("ProductVariantAttributeValue");
            this.HasKey(pvav => pvav.Id);
            this.Property(pvav => pvav.Name).IsRequired().HasMaxLength(400);


            this.HasRequired(pvav => pvav.ProductVariantAttribute)
                .WithMany(pva => pva.ProductVariantAttributeValues)
                .HasForeignKey(pvav => pvav.ProductVariantAttributeId);
        }
    }
}